<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ide="http://www.idee.es/mne" xmlns:gml="http://www.opengis.net/gml" xmlns:wfs="http://www.opengis.net/wfs" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.idee.es/mne http://www.idee.es:80/IDEE-WFS-Nomenclator/wfs?request=DescribeFeatureType&amp;amp;typename=Entidad" version="1.0">
    <xsl:template match="/">
        <places>
            <xsl:for-each select="ide:ResultCollection/gml:featureMember/ide:Entidad">  
                <xsl:variable name="placeId">
                    <xsl:if test="@fid">
                         <xsl:value-of select="@fid"/>
                    </xsl:if>
                </xsl:variable>
                <place id="{$placeId}">
                    <name>
                        <xsl:value-of select="ide:nombreEntidad/ide:nombre"/>
                    </name>
                    <type>
                        <xsl:value-of select="ide:tipoEntidad/ide:tipo"/>
                    </type>
                    <xsl:if test="ide:entidadLocal/ide:provincia">
                        <province>
                            <xsl:value-of select="ide:entidadLocal/ide:provincia"/>
                        </province>
                    </xsl:if>
                    <xsl:if test="ide:entidadLocal/ide:municipio">
                        <municipality>
                            <xsl:value-of select="ide:entidadLocal/ide:municipio"/>
                        </municipality>
                    </xsl:if>
                    <xsl:if test="ide:posicionEspacial/gml:Point/gml:coordinates">
                        <coordinates>
                            <xsl:value-of select="ide:posicionEspacial/gml:Point/gml:coordinates"/>
                        </coordinates>
                    </xsl:if>
                </place>    
            </xsl:for-each>   
        </places>    
    </xsl:template>
</xsl:stylesheet>
